package com.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dao.StudentDAO;
import com.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@SuppressWarnings("all")
@Service
public class StudentService extends ServiceImpl<StudentDAO, Student> {

    @Autowired
    private StudentDAO studentDAO;

    public IPage searchStudent(int page, int limit, Map m){
        Page p = new Page(page,limit);
        return studentDAO.searchStudent(p,m);
    }

    /**
     *  根据账号查学生信息
     * @param username  账号
     * @return
     */
    public Student queryStudent(String username) {
        // 根据账号查学生信息
        Student student = studentDAO.queryStudent(username);
        return student;
    }


    /**
     *  修改学生信息
     * @param student  学生信息
     * @return
     */
    public int updateStudent(Student student) {
        // 修改学生信息
        int n=studentDAO.updateStudent(student);
        return n;
    }

}
